package com.qf.view;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author bss
 * @version V1.0
 * @Project 02Day01
 * @Package com.qf.view
 * @Description:
 * @Date 2022/9/5 10:19
 */
@WebServlet("/view")
public class ViewServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        Object key = req.getAttribute("key");
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter writer = resp.getWriter();
        writer.println("<html>");
        writer.println("<head>");
        writer.println("<title>展示页面</title>");
        writer.println("</head>");
        writer.println("<body>");
        writer.println("测试转发和重定向"+key);
        writer.println("</body>");
        writer.println("</html>");
    }
}
